const express = require('express');
const { uploadFile } = require('../controllers/uploadController');

const router = express.Router();

/**
 * @swagger
 * /common/upload:
 *   post:
 *     summary: 上传文件
 *     consumes:
 *       - multipart/form-data
 *     parameters:
 *       - in: formData
 *         name: file
 *         type: file
 *         description: 要上传的文件
 *     responses:
 *       200:
 *         description: 文件上传成功
 *         content:
 *           application/json:
 *             schema:
 *               type: object
 *               properties:
 *                 message:
 *                   type: string
 *                   example: 文件上传成功
 *                 fileUrl:
 *                   type: string
 *                   example: http://localhost:3000/uploads/1617709527281-我的图片.png
 */
router.post('/upload',uploadFile);

module.exports = router;
